﻿namespace ApiGateway.Config
{
    /// <summary>
    /// IP黑名单配置
    /// </summary>
    public class IpBlackConfig
    {
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnable
        {
            get;
            set;
        } = false;
        /// <summary>
        /// 是否使用本地名单
        /// </summary>
        public bool IsLocal
        {
            get;
            set;
        } = true;
        /// <summary>
        /// 本地配置
        /// </summary>
        public IpBlackLocal Local
        {
            get;
            set;
        } = new IpBlackLocal();

        /// <summary>
        /// 远程
        /// </summary>
        public IpBlackRemote Remote
        {
            get;
            set;
        } = new IpBlackRemote();
    }
    /// <summary>
    /// 远端黑名单配置
    /// </summary>
    public class IpBlackRemote
    {
        /// <summary>
        /// 启用本地缓存
        /// </summary>
        public bool EnableCache
        {
            get;
            set;
        } = true;
        /// <summary>
        /// 黑名单缓存路径
        /// </summary>
        public string CachePath
        {
            get;
            set;
        } = "BlackCache";

        /// <summary>
        /// 同步缓存的时间(秒)
        /// </summary>
        public int SyncVerTime
        {
            get;
            set;
        } = 120;
    }
    /// <summary>
    /// 本地IP黑名单
    /// </summary>
    public class IpBlackLocal
    {
        /// <summary>
        /// 保存黑名单的目录
        /// </summary>
        public string DirPath
        {
            get;
            set;
        } = "Black";
        /// <summary>
        /// 数据同步时间(秒)
        /// </summary>
        public int SyncTime
        {
            get;
            set;
        } = 120;
    }
}
